/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Logger;

import java.io.File;
import java.io.IOException;
import java.util.logging.*;

/**
 *
 * @author BETA911
 */
public class Logging {

    private static String path = null;
    private static FileHandler handler;
    private static File logfile;
    private static Logger log;
    
    public Logging(){
        path = "C:\\logger_project_2tin_groep18.log";            
        logfile = new File(path);
    }
    
    public void WriteLine(String message) throws IOException{
        if (logfile.exists()){
           //append so filehandler = true
           handler = new FileHandler(path, true);         
        } else {
           //new file, filehandler = false
           handler = new FileHandler(path, false);
        }        
        handler.setFormatter(new SimpleFormatter());
        log = Logger.getLogger("log_file");
        log.addHandler(handler);
        log.info(message);
    }
}
